package com.ht.utils;

import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@Slf4j
public class CloseStreamUtil {
    /**
     * 关闭流
     *
     * @param inputStream  输入流
     * @param outputStream 输出流
     */
    public static synchronized void closeStream(InputStream inputStream, OutputStream outputStream) {
        try {
            if (inputStream == null) {
                return;
            }
            inputStream.close();
            if (outputStream == null) {
                return;
            }
            outputStream.close();
        } catch (IOException e) {
            log.error(e.getMessage(), e);
        }
    }
}
